<head th:fragment="head">
<meta charset="utf-8"/>
<meta name="renderer" content="webkit|ie-comp|ie-stand"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="/lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="/h-ui.admin/css/style.css" />
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title th:text='${title}'>建材列表</title>

<link rel="stylesheet" href="/lib/zTree/v3/css/zTreeStyle/zTreeStyle.css" type="text/css" />
<script type="text/javascript" src="/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="/h-ui/js/H-ui.min.js"></script> 
<script type="text/javascript" src="/h-ui.admin/js/H-ui.admin.js"></script>

<script type="text/javascript">
$(function(){
	
	if($('#province').length>0){
		$.ajax({
			url:"/admin/getProvinceList",
			type:"POST",
			dataType:"json",
			async:false,  
			data:'',
			success:function(data){
				if(data){
					$.each(data,function(index,value){
						$("#province").append("<option value="+value.code+">"+value.name+"</option>");
					});
				}
			}
		});
	}
	var province = $('#province').attr('value');
	var city = $('#city').attr('value');
	var district = $('#district').attr('value');
	if(province!=''){
		$('#province').val(province);
		getCity($('#province').val());
	}
	if(city!=''){
		$('#city').val(city);
		getDistrict(city);
	}
	if(district!=''){
		$('#district').val(district);
	}
	//区域
	$('#province').change(function(){
		getCity($(this).val());
	});
	$('#city').change(function(){
		getDistrict($(this).val());
	});
});
function getCity(code){
	$("#city option:gt(0)").remove();
	$("#district option:gt(0)").remove();
	$.ajax({
		url:"/admin/getChildList",
		type:"POST",
		dataType:"json",
		async:false,  
		data:"code="+code,
		success:function(data){
			if(data){
				$.each(data,function(index,value){
					$("#city").append("<option value="+value.code+">"+value.name+"</option>");
				});
			}
		}
	});
}
function getDistrict(code){
	$("#district option:gt(0)").remove();
	$.ajax({
		url:"/admin/getChildList",
		type:"POST",
		dataType:"json",
		async:false,  
		data:"code="+code,
		success:function(data){
			if(data){
				$.each(data,function(index,value){
					$("#district").append("<option value="+value.code+">"+value.name+"</option>");
				});
			}
		}
	});
}

/**
 * 重置
 */
function doFormReset(formId){
	var Obj = $("#"+formId);
	var inputs = $(Obj).find("input[type='text']");
	var inputs_hidden = $(Obj).find("input[type='hidden']");
	
	$(inputs).each(function(){
		$(this).val("");
	});
	
	$(inputs_hidden).each(function(){
		$(this).val("");
	});
	
	var selects = $(Obj).find("select");
	
	$(selects).each(function(){
		$(this).val("");
	});
	
}

//打开页面
function show(title,url,id){
	var index = layer.open({
		type: 2,
		title: title,
		content: url
	});
	layer.full(index);
}
//打开页面
function toShow(title,url,id){
	var index = layer.open({
		type: 2,
		title: title,
		content: url+"?id="+id
	});
	layer.full(index);
}

function toback(){
// 	alert("刷新父级的时候会自动关闭弹层。")
// 	window.parent.location.reload();
	self.location=document.referrer;
}
function toBack(){
// 	alert("刷新父级的时候会自动关闭弹层。")
	window.parent.location.reload();
}
</script>
</head>